Skip to content

some features and improvements#3

Merged
winapiadmin merged 17 commits into
test_chesslibfrom
test_stablerel_thread1
Apr 25, 2026
Merged

some features and improvements#3
winapiadmin merged 17 commits into
test_chesslibfrom
test_stablerel_thread1

Conversation

@winapiadmin

Copy link
Copy Markdown
Owner

Passed STC:

--------------------------------------------------
Results of new vs base (10+0.1, NULL, 16MB, UHO_Lichess_4852_v1.epd):
Elo: 51.67 +/- 8.40, nElo: 92.31 +/- 14.79
LOS: 100.00 %, DrawRatio: 47.36 %, PairsRatio: 2.82
Games: 2120, Wins: 517, Losses: 204, Draws: 1399, Points: 1216.5 (57.38 %)
Ptnml(0-2): [8, 138, 502, 357, 55], WL/DD Ratio: 0.11
LLR: 2.95 (100.2%) (-2.94, 2.94) [0.00, 2.00]
--------------------------------------------------

Passed LTC:

--------------------------------------------------
Results of new vs base (60+0.6, NULL, 16MB, UHO_Lichess_4852_v1.epd):
Elo: 108.69 +/- 10.86, nElo: 199.39 +/- 18.67
LOS: 100.00 %, DrawRatio: 41.80 %, PairsRatio: 12.34
Games: 1330, Wins: 461, Losses: 58, Draws: 811, Points: 866.5 (65.15 %)
Ptnml(0-2): [1, 28, 278, 283, 75], WL/DD Ratio: 0.11
LLR: 2.95 (100.1%) (-2.94, 2.94) [0.00, 2.00]
--------------------------------------------------

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 55b4b0e9a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread uci.cpp
}

searchThread = std::thread([ss = std::move(ss)]() mutable {
search::search(pos, parse_limits(ss));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Snapshot pos before launching the search thread

The worker is started with search::search(pos, ...), where pos is a mutable global also written by handlePosition(). Because loop() keeps accepting commands after go, a position ... command arriving before stop/join can mutate pos while the search thread is reading/copying it, which is a data race and can produce analysis for a mixed position. Capture a board snapshot before spawning the thread (or guard pos with synchronization).

Useful? React with 👍 / 👎.

Comment thread uci.cpp
Comment on lines +77 to +80
if (searchThread.joinable()) {
search::stop();
searchThread.join();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Prevent TT option changes during asynchronous search

After go returns, the command loop can still process setoption; in this codebase, Hash/Clear Hash options in main.cpp call search::tt.resize()/clear(), while the worker thread simultaneously calls tt.lookup()/store() in search.cpp. This unsynchronized mutation can free or overwrite TT storage during search, causing crashes or corrupted results when options are changed mid-search. Gate mutating commands until the worker is joined, or protect TT with proper synchronization.

Useful? React with 👍 / 👎.

Comment thread uci.cpp Outdated
return limits;
}
void handleGo(std::istringstream &ss) { search::search(pos, parse_limits(ss)); }
std::thread searchThread;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Join searchThread when the input loop exits

The global std::thread is joined on go/stop/quit, but not when loop() ends via EOF. If stdin closes after a go command, searchThread can remain joinable, and destroying a joinable std::thread triggers std::terminate at shutdown (even if the worker already finished). Add a join on the EOF path or use a thread type with automatic joining semantics.

Useful? React with 👍 / 👎.

@winapiadmin
winapiadmin merged commit 26e4720 into test_chesslib Apr 25, 2026
4 checks passed
@winapiadmin
winapiadmin deleted the test_stablerel_thread1 branch April 25, 2026 10:43
winapiadmin added a commit that referenced this pull request Jul 9, 2026
* Delete Makefile

* integrated library

* Create games.yml

* Update games.yml

* Update timeman.cpp

* Update games.yml

* Update games.yml

* Update games.yml

* Update games.yml

* Update games.yml

* Update games.yml

* Update eval.cpp

* Update eval.cpp

* Update eval.h

* Update movepick.cpp

* Update movepick.h

* Update movepick.cpp

* Update search.cpp

* Update eval.h

* Update eval.cpp

* Update movepick.h

* Update search.cpp

* Update search.cpp

* Update movepick.cpp

* Update movepick.cpp

* Update movepick.cpp

* Update movepick.cpp

* Update movepick.cpp

* Update games.yml

* Update games.yml

* Update games.yml

* extend time control (6*time)

* Update games.yml

* set pv if really hit TT

* Update games.yml

* Update search.cpp

* Update games.yml

* Update games.yml

* fix regression of null pointer deref

* clear PV

* Update search.cpp

* fix overflow

* implemented quiescence and fix illegal PV (variable shadowing)

* no functional changes

* fix typo

* Update games.yml

* Update games.yml

* Update games.yml

* update source

* Update uci.cpp

* some features and improvements (#3)

fixed some bugs
implemented LMR and NMP, features, etc.

Passed STC:

--------------------------------------------------
Results of new vs base (10+0.1, NULL, 16MB, UHO_Lichess_4852_v1.epd):
Elo: 51.67 +/- 8.40, nElo: 92.31 +/- 14.79
LOS: 100.00 %, DrawRatio: 47.36 %, PairsRatio: 2.82
Games: 2120, Wins: 517, Losses: 204, Draws: 1399, Points: 1216.5 (57.38 %)
Ptnml(0-2): [8, 138, 502, 357, 55], WL/DD Ratio: 0.11
LLR: 2.95 (100.2%) (-2.94, 2.94) [0.00, 2.00]
--------------------------------------------------

Passed LTC:

--------------------------------------------------
Results of new vs base (60+0.6, NULL, 16MB, UHO_Lichess_4852_v1.epd):
Elo: 108.69 +/- 10.86, nElo: 199.39 +/- 18.67
LOS: 100.00 %, DrawRatio: 41.80 %, PairsRatio: 12.34
Games: 1330, Wins: 461, Losses: 58, Draws: 811, Points: 866.5 (65.15 %)
Ptnml(0-2): [1, 28, 278, 283, 75], WL/DD Ratio: 0.11
LLR: 2.95 (100.1%) (-2.94, 2.94) [0.00, 2.00]
--------------------------------------------------

* some QoL changes and specifically, BUGS.

* library side fix nullmoves

* Apply clang-format

* Update eval.cpp

* Update search.cpp

* Fix typo in move type check for score calculation

* Update uci.cpp

* Fix FEN setting in engine loop

* Update uci.cpp

* improvements and bugfix (#6)

Passed STC (elo1=2): https://github.com/winapiadmin/cppchess_engine/actions/runs/28851470047

(mostly) pass LTC (elo1=2): https://github.com/winapiadmin/cppchess_engine/actions/runs/28864852436

Passed STC (elo1=5): https://github.com/winapiadmin/cppchess_engine/actions/runs/28876353922/job/85652602141

Passed LTC (elo1=5): https://github.com/winapiadmin/cppchess_engine/actions/runs/28876032178

Improvement since beginning of the PR:
--------------------------------------------------
Results of new vs base (10+0.1, NULL, 64MB, UHO_Lichess_4852_v1.epd):
Elo: 111.48 +/- 22.41, nElo: 152.89 +/- 28.67
LOS: 100.00 %, DrawRatio: 30.14 %, PairsRatio: 4.05
Games: 564, Wins: 256, Losses: 81, Draws: 227, Points: 369.5 (65.51 %)
Ptnml(0-2): [4, 35, 85, 98, 60], WL/DD Ratio: 0.81
LLR: 2.95 (100.3%) (-2.94, 2.94) [0.00, 5.00]

---------

Co-authored-by: GitHub Actions <actions@github.com>

* Update games.yml

* Update Makefile

* resolved some issues, no functional changes

* Apply clang-format

* Potential fix for pull request finding 'CodeQL / Workflow does not contain permissions'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

---------

Co-authored-by: GitHub Actions <actions@github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants